package com.news.common;

import javax.servlet.Servlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author:weiming
 * @Date:2021/3/31
 */
public class ServletResp {
    public static void resp(HttpServletResponse response , String commonResult){
        try {
            response.setHeader("Pragma", "No-cache");
            response.setHeader("Cache-Control", "no-cache");
            response.setDateHeader("Expires", 0);
            response.setContentType("application/json; charset=utf-8");
            response.getWriter().println(commonResult);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
